#include <stdio.h>
#include <pthread.h>
typedef struct
{
	int id;
	char name[10];
}user;
void* thread_func(void* data);
int main(void)
{
	pthread_t thread_id;
	int res = 0;
	user u = {1,"jin"};
	if((res = pthread_create(&thread_id,NULL,thread_func,(void*)&u)) != 0)
	{
		perror("create thread error");
	}
	// 指针变量接收要回传的数据
	void* join_res;
	// 要传递的是指针变量的地址
	pthread_join(thread_id,&join_res);
	printf("id = %d;name = %s\n",((user*)join_res)->id,((user*)join_res)->name);
	return 0;
}
void* thread_func(void* data)
{
	// 先转换指针
	user* u = (user*)data;
	printf("id = %d;name = %s\n",u->id,u->name);
	u->id = 6;
	// 返回要返回的数据的地址
	return (void*)u;
}
